/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

/*!
	\file nodeList.h
	\author Cory Dixon
*/

#ifndef __NODE_WINDOW_H
#define __NODE_WINDOW_H

#include <gtk/gtk.h>
#include "clientList.h"
#include "NodePages.h"

//--- Tab number of the pages ---//
enum {
	TELEM_PAGE = 0,
	PTH_PAGE,
	CHAINING_PAGE,
	COMM_PAGE,
	GPS_PAGE,
	TRACK_PAGE,
	JOYSTICK_PAGE,
	PAS_PAGE,
	ANT_PAGE,
	DM_PAGE,
	NUM_PAGES
};

class NodeWindow 
{
	// node user interface window 
	String ui_file;

	GtkWidget   * node_win;
	GtkWidget   * notebook;
	Client      * client;
	GtkBuilder  * builder;

public:
	NodeWindow();
	~NodeWindow();

	void create_node_window(Client *win_client);
	void update_window();

	static gboolean node_window_destroy(GtkWidget * widget, GdkEventKey * event, gpointer user_data);

	Client *getClient() { return client; }
	void show() { gtk_widget_show(node_win); }
	void hide() { gtk_widget_hide(node_win); }
	
	// called by g timer, calls refreshNodes
	static gboolean timeout_cb(gpointer user_data);

	// use this function to indicate a command or ACK has been received
	void setCMD_RX(uint8_t cmd_id, int ack_nack=-1); 

	NodePage *node_pages[NUM_PAGES]; // NUM_PAGES

};

#endif
